<?php

use Webman\Route;

Route::group('/core', function () {
    Route::get('/captcha', [\app\admin\controller\LoginController::class, 'captcha']);
    Route::post('/login', [\app\admin\controller\LoginController::class, 'login']);
    Route::get('/getSystemConfig', [\app\admin\controller\LoginController::class, 'getSystemConfig']);
    Route::get("/system/dictData",[\app\admin\controller\SystemController::class, 'dictData']);
    Route::get("/system/dictAll",[\app\admin\controller\SystemController::class, 'dictAll']);
    Route::get('/system/user', [\app\admin\controller\SystemController::class, 'userInfo']);
	Route::get('/system/clearAllCache', [\app\admin\controller\SystemController::class, 'clearAllCache']);
    Route::get("/system/getResourceList",[\app\admin\controller\SystemController::class, 'getResourceList']);
    Route::post("/system/saveNetworkImage",[\app\admin\controller\SystemController::class, 'saveNetworkImage']);
    Route::get("/system/downloadByHash/{hash}",[\app\admin\controller\SystemController::class, 'downloadByHash']);
    Route::get("/system/getFileInfoById/{id}",[\app\admin\controller\SystemController::class, 'getFileInfoById']);
    Route::get("/system/getFileInfoByHash/{hash}",[\app\admin\controller\SystemController::class, 'getFileInfoByHash']);
    Route::get("/system/getUserList",[\app\admin\controller\SystemController::class, 'getUserList']);
    Route::post("/system/getUserInfoByIds",[\app\admin\controller\SystemController::class, 'getUserInfoByIds']);
    Route::get("/system/getLoginLogList",[\app\admin\controller\SystemController::class, 'getLoginLogList']);
    Route::get("/system/getOperationLogList",[\app\admin\controller\SystemController::class, 'getOperationLogList']);
    Route::get("/system/monitor",[\app\admin\controller\SystemController::class, 'getServerInfo']);
    Route::get("/system/getPlugin",[\app\admin\controller\SystemController::class, 'getPlugin']);

    Route::get("/logs/getLoginLogPageList",[\app\admin\controller\system\SystemLogController::class, 'getLoginLogPageList']);
    Route::delete("/logs/deleteLoginLog",[\app\admin\controller\system\SystemLogController::class, 'deleteLoginLog']);
    Route::get("/logs/getOperLogPageList",[\app\admin\controller\system\SystemLogController::class, 'getOperLogPageList']);
    Route::delete("/logs/deleteOperLog",[\app\admin\controller\system\SystemLogController::class, 'deleteOperLog']);
    Route::get("/email/index",[\app\admin\controller\system\SystemMailController::class, 'index']);
    Route::delete("/email/destroy",[\app\admin\controller\system\SystemMailController::class, 'destroy']);

    fastRoute('post', \app\admin\controller\system\SystemPostController::class);
    Route::get("/post/accessPost",[\app\admin\controller\system\SystemPostController::class, 'accessPost']);
    Route::post("/post/downloadTemplate",[\app\admin\controller\system\SystemPostController::class, 'downloadTemplate']);

    fastRoute('menu', \app\admin\controller\system\SystemMenuController::class);
    fastRoute('dictType', \app\admin\controller\system\SystemDictTypeController::class);
    fastRoute('dictData', \app\admin\controller\system\SystemDictDataController::class);
    fastRoute('attachment', \app\admin\controller\system\SystemUploadfileController::class);

    fastRoute('role', \app\admin\controller\system\SystemRoleController::class);
    Route::get("/role/accessRole",[\app\admin\controller\system\SystemRoleController::class, 'accessRole']);
    Route::get("/role/getMenuByRole/{id}",[\app\admin\controller\system\SystemRoleController::class,'getMenuByRole']);
    Route::get("/role/getDeptByRole/{id}",[\app\admin\controller\system\SystemRoleController::class,'getDeptByRole']);
    Route::post("/role/menuPermission/{id}",[\app\admin\controller\system\SystemRoleController::class,'menuPermission']);
    Route::post("/role/dataPermission/{id}",[\app\admin\controller\system\SystemRoleController::class,'dataPermission']);

    fastRoute("dept", \app\admin\controller\system\SystemDeptController::class);
    Route::get("/dept/accessDept",[\app\admin\controller\system\SystemDeptController::class, 'accessDept']);
    Route::get("/dept/leaders",[\app\admin\controller\system\SystemDeptController::class, 'leaders']);
    Route::post("/dept/addLeader",[\app\admin\controller\system\SystemDeptController::class, 'addLeader']);
    Route::delete("/dept/delLeader",[\app\admin\controller\system\SystemDeptController::class, 'delLeader']);

    fastRoute("user", \app\admin\controller\system\SystemUserController::class);
    Route::post("/user/updateInfo",[\app\admin\controller\system\SystemUserController::class, 'updateInfo']);
    Route::post("/user/modifyPassword",[\app\admin\controller\system\SystemUserController::class, 'modifyPassword']);
    Route::post("/user/clearCache",[\app\admin\controller\system\SystemUserController::class, 'clearCache']);
    Route::post("/user/initUserPassword",[\app\admin\controller\system\SystemUserController::class, 'initUserPassword']);
    Route::post("/user/setHomePage",[\app\admin\controller\system\SystemUserController::class, 'setHomePage']);

    fastRoute('crontab', \app\admin\controller\system\SystemCrontabController::class);
    Route::post("/crontab/run",[\app\admin\controller\system\SystemCrontabController::class, 'run']);
    Route::get("/crontab/logPageList",[\app\admin\controller\system\SystemCrontabController::class, 'logPageList']);
    Route::delete('/crontab/deleteCrontabLog',[\app\admin\controller\system\SystemCrontabController::class, 'deleteCrontabLog']);

    Route::get("/dataMaintain/index",[\app\admin\controller\tool\DataMaintainController::class, 'index']);
    Route::get("/dataMaintain/dataSource",[\app\admin\controller\tool\DataMaintainController::class, 'source']);
    Route::get("/dataMaintain/detailed",[\app\admin\controller\tool\DataMaintainController::class, 'detailed']);
    Route::post("/dataMaintain/optimize",[\app\admin\controller\tool\DataMaintainController::class, 'optimize']);
    Route::post("/dataMaintain/fragment",[\app\admin\controller\tool\DataMaintainController::class, 'fragment']);

    // 文件操作相关接口
    Route::post("/system/uploadImage",[\app\admin\controller\UploadController::class, 'upload']);
    Route::post("/system/uploadFile",[\app\admin\controller\UploadController::class, 'upload']);

});
Route::group('/tool', function () {
    fastRoute('code', \app\admin\controller\tool\GenerateTablesController::class);
    Route::post("/code/loadTable",[\app\admin\controller\tool\GenerateTablesController::class, 'loadTable']);
    Route::get("/code/getTableColumns",[\app\admin\controller\tool\GenerateTablesController::class, 'getTableColumns']);
    Route::get("/code/preview/{id}",[\app\admin\controller\tool\GenerateTablesController::class, 'preview']);
    Route::post("/code/generate",[\app\admin\controller\tool\GenerateTablesController::class, 'generate']);
    Route::post("/code/generateFile",[\app\admin\controller\tool\GenerateTablesController::class, 'generateFile']);
    Route::post("/code/sync/{id}",[\app\admin\controller\tool\GenerateTablesController::class, 'sync']);
});

//设置路由
Route::group('/config', function () {
    // 基础配置
    fastRoute('configGroup', \app\admin\controller\setting\SystemConfigGroupController::class);
    Route::post("/configGroup/email",[\app\admin\controller\setting\SystemConfigGroupController::class, 'email']);
    fastRoute('config', \app\admin\controller\setting\SystemConfigController::class);
    Route::post("/config/batchUpdate",[\app\admin\controller\setting\SystemConfigController::class, 'batchUpdate']);
    Route::post("/config/setConfigUpdate",[\app\admin\controller\setting\SystemConfigController::class, 'setConfigUpdate']);
    Route::get("/config/getConfigValues",[\app\admin\controller\setting\SystemConfigController::class, 'getConfigValues']);
    // 存储配置
    Route::post('/setting/storage', [\app\admin\controller\setting\StorageController::class, 'list']);
    Route::post('/setting/storage/changeStatus', [\app\admin\controller\setting\StorageController::class, 'changeStatus']);
    Route::post('/setting/storage/update', [\app\admin\controller\setting\StorageController::class, 'edit']);
     // 短信配置
    Route::post('/setting/sms', [\app\admin\controller\setting\SmsController::class, 'lists']);
    Route::post('/setting/sms/changeStatus', [\app\admin\controller\setting\SmsController::class, 'changeStatus']);
    Route::post('/setting/sms/update', [\app\admin\controller\setting\SmsController::class, 'edit']);
     // 支付配置
    Route::post('/setting/redaPayConfig', [\app\admin\controller\setting\PayConfigController::class, 'redaPayConfig']);
    Route::post('/setting/editPayConfig', [\app\admin\controller\setting\PayConfigController::class, 'editPayConfig']);
});

//前端接口
Route::disableDefaultRoute('', 'api');
